home *** CD-ROM | disk | FTP | other *** search
- // Copyright (C) 1997-2002 Alias|Wavefront,
- // a division of Silicon Graphics Limited.
- //
- // The information in this file is provided for the exclusive use of the
- // licensees of Alias|Wavefront. Such users have the right to use, modify,
- // and incorporate this code into other products for purposes authorized
- // by the Alias|Wavefront license agreement, without fee.
- //
- // ALIAS|WAVEFRONT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- // INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- // EVENT SHALL ALIAS|WAVEFRONT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- // CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- // DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- // TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- // PERFORMANCE OF THIS SOFTWARE.
- //
- //
- //
- // Alias|Wavefront Script File
- // MODIFY THIS AT YOUR OWN RISK
- //
- // Creation Date: Jan 30, 1996
- // Author: laf
- //
- // Description:
- // This proc fills the propMod tool property sheet with values.
- // See also sphereProperties.mel
- //
- // Input Arguments:
- // $toolName - this is the name of the instance of the tool
- // that the property sheet is modifying.
- //
- // Return Value:
- // None.
- //
- //
- //
- //
-
- global proc string propModAnimCurveBuild( string $name )
- {
- global string $gPropModAnimCurvePrefix;
-
- if( "" == $name ) {
- $name = `createNode animCurveUU -n $gPropModAnimCurvePrefix`;
- setKeyframe -f 0 -v 100 $name;
- setKeyframe -f 10 -v 0 $name;
- }
-
- return $name;
- }
-
- global proc propModAnimCurveSet( string $name )
- {
- string $curveName = propModAnimCurveBuild( $name );
- propModCtx -e -ac $curveName `currentCtx`;
- }
-
- global proc propModAnimCurveParamSet( string $name )
- {
- string $curveName = propModAnimCurveBuild( $name );
- propModCtx -e -acp $curveName `currentCtx`;
- }
-
- global proc propModDirCheckToVec( int $which, int $state )
- {
- string $cc = `currentCtx`;
- float $dir[] = `propModCtx -q -d $cc`;
- if( $state ) {
- $dir[$which] = 1.0;
- }
- else {
- $dir[$which] = 0.0;
- }
- propModCtx -e -d $dir[0] $dir[1] $dir[2] $cc;
- }
-
- global proc propModLinearDistToSlope( float $dist )
- {
- float $lin;
- if( 0.0 == $dist ) {
- $lin = 1e6;
- }
- else {
- $lin = -1.0/$dist;
- }
-
- propModCtx -e -l $lin `currentCtx`;
- }
-
- global proc propModLinearParamCutoff( int $which, float $dist )
- {
- // Query the existing values
- string $cc = `currentCtx`;
- float $distUV[] = `propModCtx -q -lp $cc`;
-
- // Send the correct new/existing value pair
- if ( $which == 0 )
- {
- propModCtx -e -lp $dist $distUV[1] `currentCtx`;
- }
- else
- {
- propModCtx -e -lp $distUV[0] $dist `currentCtx`;
- }
- }
-
-
- global proc propModPowerCutoff( int $which, float $dist )
- {
- // Query the existing values
- string $cc = `currentCtx`;
- float $distUV[] = `propModCtx -q -pcp $cc`;
-
- // Send the correct new/existing value pair
- if ( $which == 0 )
- {
- propModCtx -e -pcp $dist $distUV[1] `currentCtx`;
- }
- else
- {
- propModCtx -e -pcp $distUV[0] $dist `currentCtx`;
- }
- }
-
-
- global proc propModNurbsCurveSet( string $name )
- {
- propModCtx -e -nc $name `currentCtx`;
- }
-
- global proc propModDimmer( int $type )
- {
- if( 1 == $type ) {
- // Linear:
- tabLayout -e -selectTab propModLinearTab propModTypeTabs;
- tabLayout -e -selectTab propModDirVis propModDirTabs;
- }
- else if( 2 == $type ) {
- // Power:
- tabLayout -e -selectTab propModPowerTab propModTypeTabs;
- tabLayout -e -selectTab propModDirVis propModDirTabs;
- }
- else if( 3 == $type ) {
- // Script:
- tabLayout -e -selectTab propModScriptTab propModTypeTabs;
- tabLayout -e -selectTab propModDirInvis propModDirTabs;
- }
- else if( 4 == $type ) {
- // Anim Curve:
- tabLayout -e -selectTab propModAnimTab propModTypeTabs;
- tabLayout -e -selectTab propModDirVis propModDirTabs;
- }
- else if( 5 == $type ) {
- tabLayout -e -selectTab propModNurbsTab propModTypeTabs;
- // NURBS
- tabLayout -e -selectTab propModDirInvis propModDirTabs;
- }
- else if( 6 == $type ) {
- // Linear: Parametric
- tabLayout -e -selectTab propModLinearParamTab propModTypeTabs;
- tabLayout -e -selectTab propModDirVis propModDirTabs;
- }
- else if( 7 == $type ) {
- // Power: Parametric
- tabLayout -e -selectTab propModPowerParamTab propModTypeTabs;
- tabLayout -e -selectTab propModDirVis propModDirTabs;
- }
- else if( 8 == $type ) {
- // Script: Parametric
- tabLayout -e -selectTab propModScriptParamTab propModTypeTabs;
- tabLayout -e -selectTab propModDirInvis propModDirTabs;
- }
- else if( 9 == $type ) {
- // Anim Curve: Parametric
- tabLayout -e -selectTab propModAnimParamTab propModTypeTabs;
- tabLayout -e -selectTab propModDirVis propModDirTabs;
- }
- else if( 10 == $type ) {
- // NURBS : Parametric
- tabLayout -e -selectTab propModNurbsParamTab propModTypeTabs;
- tabLayout -e -selectTab propModDirInvis propModDirTabs;
- }
- }
-
-
- global proc propModValues( string $toolName )
- //
- // Description:
- // Sets the state of the property sheet based on the values
- // in the tool context.
- //
- {
- // set my top layout to be the current $parent
- //
- string $parent = (`toolPropertyWindow -q -location` + "|propMod");
- setParent $parent;
-
- int $type = `propModCtx -q -t $toolName`;
- float $lin = `propModCtx -q -l $toolName`;
- string $script = `propModCtx -q -s $toolName`;
- string $scriptUV = `propModCtx -q -sp $toolName`;
- string $anim = `propModCtx -q -ac $toolName`;
- string $animUV = `propModCtx -q -acp $toolName`;
- float $pc = `propModCtx -q -pc $toolName`;
- float $pcUV[] = `propModCtx -q -pcp $toolName`;
- float $pd = `propModCtx -q -pd $toolName`;
- float $pdp = `propModCtx -q -pdp $toolName`;
- float $dir[] = `propModCtx -q -d $toolName`;
- float $linUV[] = `propModCtx -q -lp $toolName`;
- string $nurbsCurve = `propModCtx -q -nc $toolName`;
- int $ws = `propModCtx -q -ws $toolName`;
-
- if( 0.0 == $lin ) {
- $lin = 1e6;
- }
- else {
- $lin = -1.0/$lin;
- }
-
- floatSliderGrp -e -v $lin linearField;
- floatSliderGrp -e -v $pc powerCutoff;
- floatSliderGrp -e -v $pd powerDegree;
- textField -e -text $anim animCurveName;
- textField -e -text $animUV animCurveNameParam;
- textFieldGrp -e -text $script scriptName;
- textFieldGrp -e -text $scriptUV scriptNameParam;
- textField -e -text $nurbsCurve nurbsCurveName;
- floatSliderGrp -e -v $linUV[0] linearFieldU;
- floatSliderGrp -e -v $linUV[1] linearFieldV;
- floatSliderGrp -e -v $pdp powerDegreeParam;
- floatSliderGrp -e -v $pcUV[0] powerCutoffU;
- floatSliderGrp -e -v $pcUV[1] powerCutoffV;
-
-
- int $buttonType;
- if ( $ws == 1 )
- {
- // Working in world space
- radioButtonGrp -e -sl 1 modSpace;
- radioButtonGrp -e -vis on modType3; // Ensure the NURBS option is available
- $buttonType = $type;
- }
- else
- {
- // Working in parametric space
- radioButtonGrp -e -sl 2 modSpace;
- radioButtonGrp -e -vis off modType3; // Ensure the NURBS option is NOT available
- $buttonType = $type - 5;
- }
-
- switch( $buttonType )
- {
- case 1:
- radioButtonGrp -e -sl 1 modType;
- break;
- case 2:
- radioButtonGrp -e -sl 2 modType;
- break;
- case 3:
- radioButtonGrp -e -sl 1 modType2;
- break;
- case 4:
- radioButtonGrp -e -sl 2 modType2;
- break;
- case 5:
- radioButtonGrp -e -sl 1 modType3;
- break;
- }
-
- checkBoxGrp -e -v1 (0.0 != $dir[0]) modDir;
- checkBoxGrp -e -v2 (0.0 != $dir[1]) modDir;
- checkBoxGrp -e -v3 (0.0 != $dir[2]) modDir;
- propModDimmer $type;
-
- // set property sheet label and icon
- //
- string $helpTag = "ProportionalModificationTool";
- toolPropertySetCommon $toolName "propMod.xpm" $helpTag;
- toolPropertySelect propMod;
- }
-